#pragma once
#include"HashTable.h"
namespace myspace
{
	template<class K,class Hash= OPEN_HASH::_Hash<K>>
	class unordered_set
	{
	public:
		struct UnorderedSetKeyOfT
		{
			const K& operator()(const K& k)
			{
				return k;
			}
		};
		typedef typename OPEN_HASH::HashTable<K, K, UnorderedSetKeyOfT,Hash>::iterator iterator;
		iterator begin()
		{
			return _ht.begin();
		}
		iterator end()
		{
			return _ht.end();
		}
		pair<iterator, bool>Insert(const K& k)
		{
			return _ht.Insert(k);
		}
	/*	void Inorder()
		{
			_ht.Inorder();
		}*/
	private:
		OPEN_HASH::HashTable<K,K, UnorderedSetKeyOfT,Hash> _ht;
	};
	void TestUnorderedSet1()
	{
		cout << "TestUnorderedSet1" << endl;
		myspace::unordered_set<int> us;
		us.Insert(3);
		us.Insert(1);
		us.Insert(2);
		us.Insert(5);
		us.Insert(4);
		us.Insert(6);
		//s.Inorder();
		unordered_set<int>::iterator it = us.begin();
		while (it != us.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;
		cout << "TestUnorderedSet1" << endl;
	}


}